import dfd = module("main/org/sdmx/model/v2/structure/keyfamily/DataflowDefinition");
import aaa = module("main/org/sdmx/model/v2/reporting/dataset/AttachableArtefactAdapter");
import ids = module("main/org/sdmx/model/v2/reporting/dataset/IDataSet");

	
/**
	* Base implementation of the IDataSet interface.
	*  
	* @author Xavier Sosnovsky, Anthony Morel
	* @author Karine Feraboli
	*/ 
class BaseDataSet extends aaa.AttachableArtefactAdapter 
	implements ids.IDataSet
{
	/*==============================Fields================================*/
		
	/**
		* @private
		*/ 
	private _reportingBeginDate:Date;
		
	/**
		* @private
		*/ 
	private _reportingEndDate:Date;
		
	/**
		* @private
		*/ 
	private _dataExtractionDate:Date;
		
	/**
		* @private
		*/ 
	private _describedBy:dfd.DataflowDefinition;
		
	/*===========================Constructor==============================*/
		
	constructor()
	{
		super();
	}
		
	/*============================Accessors===============================*/
		
	/**
		* @inheritDoc
		*/ 
	public setReportingBeginDate(beginDate:Date) {
		if (null != this._reportingEndDate && null != beginDate 
            && beginDate > this._reportingEndDate) {
				throw new Error("The start of the reporting " + 
						"period cannot be after the end of the reporting " + 
						"period");
		} else {
            this._reportingBeginDate = beginDate;
		}
	}
		
	/**
		* @inheritDoc
		*/ 
	public getReportingBeginDate():Date {
        return this._reportingBeginDate;
	}
		
	/**
		* @inheritDoc
		*/ 
	public setReportingEndDate(endDate:Date) {
        if (null != this._reportingBeginDate && null != endDate 
            && endDate < this._reportingBeginDate) {
				throw new Error("The end of the reporting period " + 
						"cannot be before the start of the reporting " + 
						"period");
		} else {
            this._reportingEndDate = endDate;
		}
	}
		
	/**
		* @inheritDoc
		*/  
	public getReportingEndDate():Date {
        return this._reportingEndDate;
	}
		
	/**
		* @inheritDoc
		*/ 
	public setDataExtractionDate(extractionDate:Date) {
        this._dataExtractionDate = extractionDate;
	}
		
	/**
		* @inheritDoc
		*/ 
	public getDataExtractionDate():Date {
        return this._dataExtractionDate;
	}
		
	/**
		* @inheritDoc
		*/ 
	public setDescribedBy(describedBy:dfd.DataflowDefinition) {
        this._describedBy = describedBy;
	}
		
	/**
		* @inheritDoc
		*/ 
	public getDescribedBy():dfd.DataflowDefinition {
        return this._describedBy;
	}
}